﻿<Controls:GlassWindow x:Class="AutoWallpaperChanger.MainWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:Controls="clr-namespace:ApplicationHelper.Controls;assembly=ApplicationHelper"
                      Title="Auto Wallpaper Changer"
                      StateChanged="GlassWindow_StateChanged"
                      WindowStartupLocation="CenterScreen"
                      Height="600"
                      Width="450"
                      ResizeMode="CanMinimize"
                      Icon="Assets/autowall.png"
                      Closing="GlassWindow_Closing">
    <Controls:GlassWindow.Resources>
        <!--Slide Show ListBoxItemPanelTemplate Style-->
        <ItemsPanelTemplate x:Key="ItemsPanelTemplateSS">
            <VirtualizingStackPanel IsItemsHost="True"
                                    Orientation="Vertical" />
        </ItemsPanelTemplate>

        <!--Slide Show ListBoxItemPanelTemplate Style-->
        <DataTemplate x:Key="ItemTemplateSS">
            <Border HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch">
                <Image x:Name="wall"
                       Source="{Binding ImageUri}"
                       MouseLeftButtonDown="wall_MouseLeftButtonDown"
                       Width="400"
                       Height="205"
                       Stretch="Fill"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center" />
            </Border>
        </DataTemplate>

        <!--Normal ListBoxAlternation Style-->
        <Style  TargetType="{x:Type ListBoxItem}">
            <Style.Triggers>
                <Trigger Property="ItemsControl.AlternationIndex"
                         Value="0">
                    <Setter Property="Background"
                            Value="#19f39611"></Setter>
                </Trigger>
                <Trigger Property="ItemsControl.AlternationIndex"
                         Value="1">
                    <Setter Property="Background"
                            Value="#19000000"></Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Controls:GlassWindow.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
        </Grid.RowDefinitions>
        <Border Margin="0"
                BorderBrush="Black"
                BorderThickness="5"
                CornerRadius="5"
                Background="White">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.568*" />
                    <ColumnDefinition Width="0.432*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="0.149*" />
                    <RowDefinition Height="0.043*" />
                    <RowDefinition Height="0.036*" />
                    <RowDefinition Height="0.389*" />
                    <RowDefinition Height="0.383*" />
                </Grid.RowDefinitions>
                <ListBox x:Name="lbFiles"
                         FontSize="16"
                         FontFamily="Calibri"
                         AlternationCount="2"
                         ScrollViewer.VerticalScrollBarVisibility="Visible"
                         Margin="2"
                         Grid.RowSpan="4"
                         BorderBrush="Black"
                         BorderThickness="2">

                </ListBox>
                <Rectangle Stroke="Black"
                           Margin="0,2,2,2"
                           Grid.RowSpan="4"
                           Grid.Column="1"
                           StrokeThickness="2"
                           Fill="#82ECE2C4" />
                <Button x:Name="btnBrowseFolder"
                        Click="btnBrowseFolder_Click"
                        HorizontalAlignment="Center"
                        Width="150"
                        Content="Browse Folder"
                        Margin="0,0,0,4.911"
                        Grid.Column="1"
                        VerticalAlignment="Bottom"
                        Height="25" />
                <CheckBox x:Name="chkRandom"
                          Click="CheckBox_Click"
                          VerticalAlignment="Center"
                          Content="Random Sequence"
                          Margin="15,0"
                          Grid.Column="1"
                          Grid.Row="1"
                          Width="145"
                          Height="15"
                          HorizontalAlignment="Center" />
                <CheckBox x:Name="chkInterval"
                          Click="CheckBox_Click"
                          IsChecked="True"
                          HorizontalAlignment="Center"
                          VerticalAlignment="Center"
                          Content="Change Wallpaper Every "
                          Margin="15,0"
                          Grid.Column="1"
                          Grid.Row="2"
                          Width="145"
                          Height="15" />
                <GroupBox Margin="37.488,6.304,31.127,91.238"
                          Grid.Column="1"
                          Grid.Row="3"
                          Header="Timer">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <RadioButton x:Name="radioIntervalSeconds"
                                     Click="radioInterval_Click"
                                     Checked="radioInterval_Checked"
                                     Margin="5.991,0,0,0"
                                     VerticalAlignment="Center"
                                     Content="Seconds"
                                     Height="20"
                                     HorizontalAlignment="Left"
                                     Width="60" />
                        <TextBox x:Name="txtTimerIntervalSeconds"
                                 HorizontalAlignment="Right"
                                 Margin="0,0,8.991,0"
                                 VerticalAlignment="Center"
                                 Width="25"
                                 Height="20"
                                 Background="#FFFFFF33"
                                 MaxLength="2" />
                        <RadioButton x:Name="radioIntervalMinutes"
                                     Click="radioInterval_Click"
                                     Checked="radioInterval_Checked"
                                     VerticalAlignment="Center"
                                     Height="20"
                                     Content="Minutes"
                                     Grid.Row="1"
                                     Margin="5.991,0,0,0"
                                     Width="60"
                                     HorizontalAlignment="Left" />
                        <TextBox x:Name="txtTimerIntervalMinutes"
                                 HorizontalAlignment="Right"
                                 Margin="0,0,8.991,0"
                                 VerticalAlignment="Center"
                                 Width="25"
                                 Height="20"
                                 Background="#FFFFFF33"
                                 MaxLength="2"
                                 Grid.Row="1" />
                        <RadioButton x:Name="radioIntervalHours"
                                     Click="radioInterval_Click"
                                     Checked="radioInterval_Checked"
                                     HorizontalAlignment="Left"
                                     VerticalAlignment="Center"
                                     Height="20"
                                     Content="Hours"
                                     Grid.Row="2"
                                     Margin="5.991,0,0,0"
                                     Width="60" />
                        <TextBox x:Name="txtTimerIntervalHours"
                                 HorizontalAlignment="Right"
                                 Margin="0,0,8.991,0"
                                 VerticalAlignment="Center"
                                 Width="25"
                                 Height="20"
                                 Background="#FFFFFF33"
                                 MaxLength="2"
                                 Grid.Row="2" />
                        <RadioButton x:Name="radioIntervalDays"
                                     Click="radioInterval_Click"
                                     Checked="radioInterval_Checked"
                                     HorizontalAlignment="Left"
                                     VerticalAlignment="Center"
                                     Height="20"
                                     Content="Days"
                                     Grid.Row="3"
                                     Margin="5.991,0,0,0"
                                     Width="60" />
                        <TextBox x:Name="txtTimerIntervalDays"
                                 HorizontalAlignment="Right"
                                 Margin="0,0,8.991,0"
                                 VerticalAlignment="Center"
                                 Width="25"
                                 Height="20"
                                 Background="#FFFFFF33"
                                 MaxLength="2"
                                 Grid.Row="3" />
                    </Grid>
                </GroupBox>
                <Button x:Name="btnChangeNow"
                        Click="btnChangeNow_Click"
                        Content="Change Selected"
                        Margin="0,0,0,43"
                        Grid.Row="3"
                        Height="25"
                        VerticalAlignment="Bottom"
                        Grid.Column="1"
                        Width="150"
                        HorizontalAlignment="Center" />
                <Button x:Name="btnChange"
                        Click="btnChange_Click"
                        Content="Save &amp; Minimize"
                        Margin="0,0,0,8"
                        Grid.Row="3"
                        Height="25"
                        VerticalAlignment="Bottom"
                        Grid.Column="1"
                        Width="150"
                        HorizontalAlignment="Center" />
                <ListBox  x:Name="lbWalls"
                          ItemTemplate="{DynamicResource ItemTemplateSS}"
                          IsSynchronizedWithCurrentItem="True"
                          ItemsPanel="{DynamicResource ItemsPanelTemplateSS}"
                          ScrollViewer.VerticalScrollBarVisibility="Visible"
                          ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                          Margin="2"
                          Grid.ColumnSpan="2"
                          Grid.Row="4"
                          ToolTip="Click on the Image to set as Wallpaper"
                          BorderBrush="Black"
                          BorderThickness="2" />
                <Image x:Name="Help"
                       MouseLeftButtonDown="Help_MouseLeftButtonDown"
                       Visibility="Collapsed"
                       HorizontalAlignment="Right"
                       Margin="0,10,10,41.142"
                       Width="32"
                       Grid.Column="1"
                       Source="Assets/help.png"
                       Cursor="Hand" />
            </Grid>
        </Border>

    </Grid>
</Controls:GlassWindow>
